package com.sky.controller.user;

import com.sky.entity.Category;
import com.sky.result.Result;
import com.sky.service.CategoryService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * ClassName: CategoryController
 * Package: com.sky.controller.user
 * Description:
 *
 * @Author: Zhang Peiyuan
 * @Create: 2024-12-21-14:21
 * @Version: v1.0
 */
@RestController("userCategoryController")
@RequestMapping("/user/category")
public class CategoryController {
    @Resource
    private CategoryService categoryService;

    /**
     * 查询菜品分类列表, 根据类型
     * @param type
     * @return
     */
    @GetMapping("/list")
    public Result<List<Category>> queryCategoryList(@RequestParam(required = false) Integer type) {
        return Result.success(categoryService.listCategory(type));
    }


}
